package org.example.text03;

/**
 * 法师类，继承姓名年龄抽象类
 */

public class Magicer extends NameRole{
    //法师等级
    private int level;
    //法师武器
    private MagicStick stick;
    @Override
    public int attack() {
        return level * 5;
    }

    @Override
    public void practise() {
        if (stick ==null){
            level++;
        }else {
            level = level + 1 + stick.fire();
        }

    }

    /**
     * 选择分支时，条件为范围判断使用if-else，条件为等值判断使用switch-case
     */

    public Magicer() {
    }

    public Magicer(String name, int age, int level, MagicStick stick) {
        super(name, age);
        this.level = level;
        this.stick = stick;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public MagicStick getStick() {
        return stick;
    }

    public void setStick(MagicStick stick) {
        this.stick = stick;
    }
}
